# Author:	gong_libin
# Date:		2016_06_01

CC ?= g++
CFLAGS ?= -g -Wall

GLB_ENV ?= /root/GlbAdpTanx-1.0.0
GLB_BIN ?= $(GLB_ENV)/bin
GLB_INC ?= $(GLB_ENV)/inc
GLB_SRC ?= $(GLB_ENV)/src
GLB_TAN ?= $(GLB_ENV)/tanx

GLB_GLIB ?= /usr/lib
GLB_GINC ?= /usr/include/GlbInc

GLB_TLIB ?= /usr/local/lib
GLB_TINC ?= $(GLB_ENV)/tanx
GLB_TOBJ ?= $(GLB_TAN)/tanx-bidding.pb.o

GLB_OBJS =					\
	$(GLB_TAN)/tanx-bidding.pb.o

GLB_LIBS =					\
	-L$(GLB_GLIB) -lglbglobal		\
	-L$(GLB_TLIB) -lprotobuf		\
	-L$(GLB_GLIB) -lpthread			\
	-L$(GLB_GLIB) -ldl

GLB_TARGETS =					\
	GlbAdpRtb				\
	GlbAdpMsg				\
	GlbAdpTb

GLB_OBJECTS =					\
	GlbAdpRtb.o				\
	GlbAdpMsg.o				\
	GlbAdpTb.o

all: $(GLB_OBJECTS) $(GLB_TARGETS) install

$(GLB_OBJECTS): %.o: %.cpp
	$(CC) -c $(CFLAGS) -I$(GLB_INC) -I$(GLB_GINC) -I$(GLB_TINC) $< -o $@

$(GLB_TARGETS): %: %.o
	$(CC) $(CFLAGS) $(GLB_OBJS) $< -o $@ $(GLB_LIBS)

install:
	cp $(GLB_TARGETS) $(GLB_BIN)

clean:
	rm -rf $(GLB_OBJECTS)
	rm -rf $(GLB_TARGETS)
